<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改【请填写功能名称】')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-process-edit" th:object="${myProcess}">
        <input name="id" th:field="*{id}" type="hidden">
        <input name="id" th:field="*{primaryKey}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">节点名称：</label>
            <div class="col-sm-8">
                <input name="nodeName" th:field="*{name}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">x轴：</label>
            <div class="col-sm-8">
                <input name="x" th:field="*{x}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">y轴：</label>
            <div class="col-sm-8">
                <input name="y" th:field="*{y}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input name="remark" th:field="*{remark}" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "data/process";
    $("#form-process-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            // $.operate.save(prefix + "/edit", $('#form-process-edit').serialize());

            $.ajax({
                url: prefix + "/edit",
                type: "post",
                dataType: "json",
                data: $('#form-process-edit').serialize(),
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍候...");
                    $.modal.disable();
                },
                success: function(result) {
                    debugger;
                    if (typeof callback == "function") {
                        callback(result);
                    }
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                        parent.location.reload();
                    } else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg);
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                    $.modal.close();
                }
            });
        }
    }
</script>
</body>
</html>